package com.geetour.columbus.customer.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.geetour.columbus.common.exceptions.ServiceException;
import com.geetour.columbus.common.model.C.Account;
import com.geetour.columbus.common.service.IAccountService;
import com.geetour.columbus.customer.bo.IAccountBO;

@Service
public class AccountServiceImpl implements IAccountService {

	private IAccountBO accountBOImpl;

	@Autowired
	public void setAccountBOImpl(IAccountBO accountBOImpl) {
		this.accountBOImpl = accountBOImpl;
	}
	
	@Override
	public Account getAccountById(Long id) throws ServiceException {
		return accountBOImpl.findAccountById(id);
	}
	
	@Override
	public int createAccount(Account account) throws ServiceException {
		if (account == null) {
			return -1;
		}
		return accountBOImpl.insertAccount(account);
	}

	@Override
	public int updateAccount(Account account) throws ServiceException {
		if (account == null) {
			return -1;
		}
		return accountBOImpl.updateAccount(account);
	}
}
